from appium.webdriver.common.appiumby import AppiumBy as By
from pages.base_page import BasePage

# 定位器
my_locator = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().text("我")')
main_profile_user_icon_locator = (By.ID, 'com.xiachufang:id/main_profile_user_icon')
photo_locator = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().resourceId("com.xiachufang:id/item_photo_picker_photo").instance(3)')
image_edit_crop_icon_locator = (By.ID, 'com.xiachufang:id/image_edit_crop_icon')
tv_crop_white_side_locator = (By.ID, 'com.xiachufang:id/tv_crop_white_side')
crop_done_locator = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().resourceId("com.xiachufang:id/crop_done")')
flat_button_locator = (By.ID, 'com.xiachufang:id/flat_button')

class MyPersonalizedPage(BasePage):
    def click_my(self):
        """
        点击我
        :return:
        """
        self.find_element(my_locator).click()

    def click_main_profile_user_icon(self):
        """
        点击头像
        :return:
        """
        self.find_element(main_profile_user_icon_locator).click()
    def click_photo(self):
        """
        点击图片
        :return:
        """
        self.find_element(photo_locator).click()
    def click_image_edit_crop_icon(self):
        """
        点击裁剪
        :return:
        """
        self.find_element(image_edit_crop_icon_locator).click()
    def click_tv_crop_white_side(self):
        """
        点击白色边框
        :return:
        """
        self.find_element(tv_crop_white_side_locator).click()
    def click_crop_done(self):
        """
        点击确认
        :return:
        """
        self.find_element(crop_done_locator).click()
    def click_flat_button(self):
        """
        点击完成
        :return:
        """
        self.find_element(flat_button_locator).click()
